<?php


abstract class BaseGrupoFamiliar extends BaseObject  implements Persistent {


	
	protected static $peer;


	
	protected $cp_grupo_familiar;


	
	protected $cf_estudiante;


	
	protected $gastos_alimenticios;


	
	protected $otros_gastos;


	
	protected $estrato_social;


	
	protected $especificacion;


	
	protected $trabaja;


	
	protected $sueldo;


	
	protected $ingreso_mensual;


	
	protected $personas_viven;


	
	protected $personas_aportan;


	
	protected $estatus;

	
	protected $alreadyInSave = false;

	
	protected $alreadyInValidation = false;

	
	public function getCpGrupoFamiliar()
	{

		return $this->cp_grupo_familiar;
	}

	
	public function getCfEstudiante()
	{

		return $this->cf_estudiante;
	}

	
	public function getGastosAlimenticios()
	{

		return $this->gastos_alimenticios;
	}

	
	public function getOtrosGastos()
	{

		return $this->otros_gastos;
	}

	
	public function getEstratoSocial()
	{

		return $this->estrato_social;
	}

	
	public function getEspecificacion()
	{

		return $this->especificacion;
	}

	
	public function getTrabaja()
	{

		return $this->trabaja;
	}

	
	public function getSueldo()
	{

		return $this->sueldo;
	}

	
	public function getIngresoMensual()
	{

		return $this->ingreso_mensual;
	}

	
	public function getPersonasViven()
	{

		return $this->personas_viven;
	}

	
	public function getPersonasAportan()
	{

		return $this->personas_aportan;
	}

	
	public function getEstatus()
	{

		return $this->estatus;
	}

	
	public function setCpGrupoFamiliar($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->cp_grupo_familiar !== $v) {
			$this->cp_grupo_familiar = $v;
			$this->modifiedColumns[] = GrupoFamiliarPeer::CP_GRUPO_FAMILIAR;
		}

	} 
	
	public function setCfEstudiante($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->cf_estudiante !== $v) {
			$this->cf_estudiante = $v;
			$this->modifiedColumns[] = GrupoFamiliarPeer::CF_ESTUDIANTE;
		}

	} 
	
	public function setGastosAlimenticios($v)
	{

		if ($this->gastos_alimenticios !== $v) {
			$this->gastos_alimenticios = $v;
			$this->modifiedColumns[] = GrupoFamiliarPeer::GASTOS_ALIMENTICIOS;
		}

	} 
	
	public function setOtrosGastos($v)
	{

		if ($this->otros_gastos !== $v) {
			$this->otros_gastos = $v;
			$this->modifiedColumns[] = GrupoFamiliarPeer::OTROS_GASTOS;
		}

	} 
	
	public function setEstratoSocial($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->estrato_social !== $v) {
			$this->estrato_social = $v;
			$this->modifiedColumns[] = GrupoFamiliarPeer::ESTRATO_SOCIAL;
		}

	} 
	
	public function setEspecificacion($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->especificacion !== $v) {
			$this->especificacion = $v;
			$this->modifiedColumns[] = GrupoFamiliarPeer::ESPECIFICACION;
		}

	} 
	
	public function setTrabaja($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->trabaja !== $v) {
			$this->trabaja = $v;
			$this->modifiedColumns[] = GrupoFamiliarPeer::TRABAJA;
		}

	} 
	
	public function setSueldo($v)
	{

		if ($this->sueldo !== $v) {
			$this->sueldo = $v;
			$this->modifiedColumns[] = GrupoFamiliarPeer::SUELDO;
		}

	} 
	
	public function setIngresoMensual($v)
	{

		if ($this->ingreso_mensual !== $v) {
			$this->ingreso_mensual = $v;
			$this->modifiedColumns[] = GrupoFamiliarPeer::INGRESO_MENSUAL;
		}

	} 
	
	public function setPersonasViven($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->personas_viven !== $v) {
			$this->personas_viven = $v;
			$this->modifiedColumns[] = GrupoFamiliarPeer::PERSONAS_VIVEN;
		}

	} 
	
	public function setPersonasAportan($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->personas_aportan !== $v) {
			$this->personas_aportan = $v;
			$this->modifiedColumns[] = GrupoFamiliarPeer::PERSONAS_APORTAN;
		}

	} 
	
	public function setEstatus($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->estatus !== $v) {
			$this->estatus = $v;
			$this->modifiedColumns[] = GrupoFamiliarPeer::ESTATUS;
		}

	} 
	
	public function hydrate(ResultSet $rs, $startcol = 1)
	{
		try {

			$this->cp_grupo_familiar = $rs->getString($startcol + 0);

			$this->cf_estudiante = $rs->getString($startcol + 1);

			$this->gastos_alimenticios = $rs->getFloat($startcol + 2);

			$this->otros_gastos = $rs->getFloat($startcol + 3);

			$this->estrato_social = $rs->getString($startcol + 4);

			$this->especificacion = $rs->getString($startcol + 5);

			$this->trabaja = $rs->getString($startcol + 6);

			$this->sueldo = $rs->getFloat($startcol + 7);

			$this->ingreso_mensual = $rs->getFloat($startcol + 8);

			$this->personas_viven = $rs->getInt($startcol + 9);

			$this->personas_aportan = $rs->getInt($startcol + 10);

			$this->estatus = $rs->getString($startcol + 11);

			$this->resetModified();

			$this->setNew(false);

						return $startcol + 12; 
		} catch (Exception $e) {
			throw new PropelException("Error populating GrupoFamiliar object", $e);
		}
	}

	
	public function delete($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("This object has already been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(GrupoFamiliarPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			GrupoFamiliarPeer::doDelete($this, $con);
			$this->setDeleted(true);
			$con->commit();
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	public function save($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("You cannot save an object that has been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(GrupoFamiliarPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			$affectedRows = $this->doSave($con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	protected function doSave($con)
	{
		$affectedRows = 0; 		if (!$this->alreadyInSave) {
			$this->alreadyInSave = true;


						if ($this->isModified()) {
				if ($this->isNew()) {
					$pk = GrupoFamiliarPeer::doInsert($this, $con);
					$affectedRows += 1; 										 										 
					$this->setCpGrupoFamiliar($pk);  
					$this->setNew(false);
				} else {
					$affectedRows += GrupoFamiliarPeer::doUpdate($this, $con);
				}
				$this->resetModified(); 			}

			$this->alreadyInSave = false;
		}
		return $affectedRows;
	} 
	
	protected $validationFailures = array();

	
	public function getValidationFailures()
	{
		return $this->validationFailures;
	}

	
	public function validate($columns = null)
	{
		$res = $this->doValidate($columns);
		if ($res === true) {
			$this->validationFailures = array();
			return true;
		} else {
			$this->validationFailures = $res;
			return false;
		}
	}

	
	protected function doValidate($columns = null)
	{
		if (!$this->alreadyInValidation) {
			$this->alreadyInValidation = true;
			$retval = null;

			$failureMap = array();


			if (($retval = GrupoFamiliarPeer::doValidate($this, $columns)) !== true) {
				$failureMap = array_merge($failureMap, $retval);
			}



			$this->alreadyInValidation = false;
		}

		return (!empty($failureMap) ? $failureMap : true);
	}

	
	public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = GrupoFamiliarPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->getByPosition($pos);
	}

	
	public function getByPosition($pos)
	{
		switch($pos) {
			case 0:
				return $this->getCpGrupoFamiliar();
				break;
			case 1:
				return $this->getCfEstudiante();
				break;
			case 2:
				return $this->getGastosAlimenticios();
				break;
			case 3:
				return $this->getOtrosGastos();
				break;
			case 4:
				return $this->getEstratoSocial();
				break;
			case 5:
				return $this->getEspecificacion();
				break;
			case 6:
				return $this->getTrabaja();
				break;
			case 7:
				return $this->getSueldo();
				break;
			case 8:
				return $this->getIngresoMensual();
				break;
			case 9:
				return $this->getPersonasViven();
				break;
			case 10:
				return $this->getPersonasAportan();
				break;
			case 11:
				return $this->getEstatus();
				break;
			default:
				return null;
				break;
		} 	}

	
	public function toArray($keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = GrupoFamiliarPeer::getFieldNames($keyType);
		$result = array(
			$keys[0] => $this->getCpGrupoFamiliar(),
			$keys[1] => $this->getCfEstudiante(),
			$keys[2] => $this->getGastosAlimenticios(),
			$keys[3] => $this->getOtrosGastos(),
			$keys[4] => $this->getEstratoSocial(),
			$keys[5] => $this->getEspecificacion(),
			$keys[6] => $this->getTrabaja(),
			$keys[7] => $this->getSueldo(),
			$keys[8] => $this->getIngresoMensual(),
			$keys[9] => $this->getPersonasViven(),
			$keys[10] => $this->getPersonasAportan(),
			$keys[11] => $this->getEstatus(),
		);
		return $result;
	}

	
	public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = GrupoFamiliarPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->setByPosition($pos, $value);
	}

	
	public function setByPosition($pos, $value)
	{
		switch($pos) {
			case 0:
				$this->setCpGrupoFamiliar($value);
				break;
			case 1:
				$this->setCfEstudiante($value);
				break;
			case 2:
				$this->setGastosAlimenticios($value);
				break;
			case 3:
				$this->setOtrosGastos($value);
				break;
			case 4:
				$this->setEstratoSocial($value);
				break;
			case 5:
				$this->setEspecificacion($value);
				break;
			case 6:
				$this->setTrabaja($value);
				break;
			case 7:
				$this->setSueldo($value);
				break;
			case 8:
				$this->setIngresoMensual($value);
				break;
			case 9:
				$this->setPersonasViven($value);
				break;
			case 10:
				$this->setPersonasAportan($value);
				break;
			case 11:
				$this->setEstatus($value);
				break;
		} 	}

	
	public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = GrupoFamiliarPeer::getFieldNames($keyType);

		if (array_key_exists($keys[0], $arr)) $this->setCpGrupoFamiliar($arr[$keys[0]]);
		if (array_key_exists($keys[1], $arr)) $this->setCfEstudiante($arr[$keys[1]]);
		if (array_key_exists($keys[2], $arr)) $this->setGastosAlimenticios($arr[$keys[2]]);
		if (array_key_exists($keys[3], $arr)) $this->setOtrosGastos($arr[$keys[3]]);
		if (array_key_exists($keys[4], $arr)) $this->setEstratoSocial($arr[$keys[4]]);
		if (array_key_exists($keys[5], $arr)) $this->setEspecificacion($arr[$keys[5]]);
		if (array_key_exists($keys[6], $arr)) $this->setTrabaja($arr[$keys[6]]);
		if (array_key_exists($keys[7], $arr)) $this->setSueldo($arr[$keys[7]]);
		if (array_key_exists($keys[8], $arr)) $this->setIngresoMensual($arr[$keys[8]]);
		if (array_key_exists($keys[9], $arr)) $this->setPersonasViven($arr[$keys[9]]);
		if (array_key_exists($keys[10], $arr)) $this->setPersonasAportan($arr[$keys[10]]);
		if (array_key_exists($keys[11], $arr)) $this->setEstatus($arr[$keys[11]]);
	}

	
	public function buildCriteria()
	{
		$criteria = new Criteria(GrupoFamiliarPeer::DATABASE_NAME);

		if ($this->isColumnModified(GrupoFamiliarPeer::CP_GRUPO_FAMILIAR)) $criteria->add(GrupoFamiliarPeer::CP_GRUPO_FAMILIAR, $this->cp_grupo_familiar);
		if ($this->isColumnModified(GrupoFamiliarPeer::CF_ESTUDIANTE)) $criteria->add(GrupoFamiliarPeer::CF_ESTUDIANTE, $this->cf_estudiante);
		if ($this->isColumnModified(GrupoFamiliarPeer::GASTOS_ALIMENTICIOS)) $criteria->add(GrupoFamiliarPeer::GASTOS_ALIMENTICIOS, $this->gastos_alimenticios);
		if ($this->isColumnModified(GrupoFamiliarPeer::OTROS_GASTOS)) $criteria->add(GrupoFamiliarPeer::OTROS_GASTOS, $this->otros_gastos);
		if ($this->isColumnModified(GrupoFamiliarPeer::ESTRATO_SOCIAL)) $criteria->add(GrupoFamiliarPeer::ESTRATO_SOCIAL, $this->estrato_social);
		if ($this->isColumnModified(GrupoFamiliarPeer::ESPECIFICACION)) $criteria->add(GrupoFamiliarPeer::ESPECIFICACION, $this->especificacion);
		if ($this->isColumnModified(GrupoFamiliarPeer::TRABAJA)) $criteria->add(GrupoFamiliarPeer::TRABAJA, $this->trabaja);
		if ($this->isColumnModified(GrupoFamiliarPeer::SUELDO)) $criteria->add(GrupoFamiliarPeer::SUELDO, $this->sueldo);
		if ($this->isColumnModified(GrupoFamiliarPeer::INGRESO_MENSUAL)) $criteria->add(GrupoFamiliarPeer::INGRESO_MENSUAL, $this->ingreso_mensual);
		if ($this->isColumnModified(GrupoFamiliarPeer::PERSONAS_VIVEN)) $criteria->add(GrupoFamiliarPeer::PERSONAS_VIVEN, $this->personas_viven);
		if ($this->isColumnModified(GrupoFamiliarPeer::PERSONAS_APORTAN)) $criteria->add(GrupoFamiliarPeer::PERSONAS_APORTAN, $this->personas_aportan);
		if ($this->isColumnModified(GrupoFamiliarPeer::ESTATUS)) $criteria->add(GrupoFamiliarPeer::ESTATUS, $this->estatus);

		return $criteria;
	}

	
	public function buildPkeyCriteria()
	{
		$criteria = new Criteria(GrupoFamiliarPeer::DATABASE_NAME);

		$criteria->add(GrupoFamiliarPeer::CP_GRUPO_FAMILIAR, $this->cp_grupo_familiar);

		return $criteria;
	}

	
	public function getPrimaryKey()
	{
		return $this->getCpGrupoFamiliar();
	}

	
	public function setPrimaryKey($key)
	{
		$this->setCpGrupoFamiliar($key);
	}

	
	public function copyInto($copyObj, $deepCopy = false)
	{

		$copyObj->setCfEstudiante($this->cf_estudiante);

		$copyObj->setGastosAlimenticios($this->gastos_alimenticios);

		$copyObj->setOtrosGastos($this->otros_gastos);

		$copyObj->setEstratoSocial($this->estrato_social);

		$copyObj->setEspecificacion($this->especificacion);

		$copyObj->setTrabaja($this->trabaja);

		$copyObj->setSueldo($this->sueldo);

		$copyObj->setIngresoMensual($this->ingreso_mensual);

		$copyObj->setPersonasViven($this->personas_viven);

		$copyObj->setPersonasAportan($this->personas_aportan);

		$copyObj->setEstatus($this->estatus);


		$copyObj->setNew(true);

		$copyObj->setCpGrupoFamiliar(NULL); 
	}

	
	public function copy($deepCopy = false)
	{
				$clazz = get_class($this);
		$copyObj = new $clazz();
		$this->copyInto($copyObj, $deepCopy);
		return $copyObj;
	}

	
	public function getPeer()
	{
		if (self::$peer === null) {
			self::$peer = new GrupoFamiliarPeer();
		}
		return self::$peer;
	}

} 